package com.rm.zeyou.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.rm.zeyou.entity.Technician;
import com.rm.zeyou.response.ApiRestResponse;
import com.rm.zeyou.service.TechnicianConsumeDetailService;
import com.rm.zeyou.util.login.TechnicianLoginUtil;
import com.rm.zeyou.vo.request.TechnicianWalletVo;
import com.rm.zeyou.vo.response.TechnicianStatisticsResponseVo;
import com.rm.zeyou.vo.response.TechnicianWalletResponseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 技师收入/支出表 前端控制器
 * </p>
 *
 * @author YanYang
 * @since 2025-03-12 15:55:09
 */
@Api(tags = "技师收入明细相关")
@RestController
@RequestMapping("/api/technicianConsumeDetail")
public class TechnicianConsumeDetailController {
    @Resource
    private TechnicianConsumeDetailService technicianConsumeDetailService;
    @Resource
    private TechnicianLoginUtil technicianLoginUtil;

    @ApiOperation("数据统计")
    @GetMapping("technicianStatistics")
    @SaCheckLogin(type = "technician")
    public ApiRestResponse<TechnicianStatisticsResponseVo> technicianStatistics() {
        Technician technician = technicianLoginUtil.getTechnician();
        return technicianConsumeDetailService.technicianStatistics(technician);
    }

    @ApiOperation(value = "技师钱包")
    @PostMapping("technicianWallet")
    @SaCheckLogin(type = "technician")
    public ApiRestResponse<TechnicianWalletResponseVo> technicianWallet(@RequestBody TechnicianWalletVo technicianWalletVo) {
        Technician technician = technicianLoginUtil.getTechnician();
        return technicianConsumeDetailService.technicianWallet(technician,technicianWalletVo);
    }

}
